<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/30
 * Time: 10:30
 */
namespace app\home\controller;
use think\Image;
Vendor('topthink.think-image.src.Image');
Vendor('topthink.think-image.src.image.Exception');
use app\service\KamYellow;

class Test extends Base{
    public function __autoload() {
        echo 11111111111111;
    }
    public function testA(){
        $img = './uploads/advert/58d0934337a94.jpg';

        $image = \think\Image::open($img);
        $thumb_path = 'uploads/advert/thumb_'.uniqid().'.png';
        $image->thumb(150,150,\think\Image::THUMB_CENTER)->save($thumb_path);
        var_dump($thumb_path);
    }
    public function kamYellow(){
        $kam = new KamYellow();
        $result = $kam->main('http://ww1.sinaimg.cn/mw600/6d050af1gw1dy8dwpjy29j.jpg');
        echo '<pre>';
        $result = json_encode($result);
        print_r($result);
    }

    public function jsonTo(){
        $json = '[{"name":"http:\/\/ulteriortest.tiannt.com\/uploads\/dynamic\/58eda306e9fb8.png","labels":[{"label":100,"level":0,"rate":0},{"label":110,"level":0,"rate":0},{"label":200,"level":0,"rate":0},{"label":210,"level":0,"rate":0},{"label":300,"level":0,"rate":0},{"label":400,"level":0,"rate":0}]}]';
        $arr = json_decode($json,true);
        dump($arr);

    }

    public function testB(){
        $iamge = './public/uploads/advert/58d22ffa2f960.jpg';
        //$img = Image::open('/public/uploads/advert/58d0992aa8907.jpg');
        $image = Image::open('./uploads/advert/58d22ffa2f960.jpg');
        dump($image);exit;
    }

    public function testC(){

        $obj = new Test1();
    }




}